package com.ruoyi.project.dict.ebookcatalog.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.framework.aspectj.lang.annotation.DataSource;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
import com.ruoyi.project.dict.ebookcatalog.domain.EbookCatalog;
import com.ruoyi.project.dict.ebookcatalog.mapper.EbookCatalogMapper;
import com.ruoyi.project.dict.ebookcatalog.service.IEbookCatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 电子书目录Service业务层处理
 *
 * @author shixiangwen
 * @date 2021-12-29
 */
@Service
@DataSource(DataSourceType.DICT)
public class EbookCatalogServiceImpl implements IEbookCatalogService {

    @Autowired
    private EbookCatalogMapper ebookCatalogMapper;

    /**
     * 查询电子书目录
     *
     * @param id 电子书目录ID
     * @return 电子书目录
     */
    @Override
    public EbookCatalog selectEbookCatalogById(Long id) {
        return ebookCatalogMapper.selectEbookCatalogById(id);
    }

    /**
     * 查询电子书目录列表
     *
     * @param ebookCatalog 电子书目录
     * @return 电子书目录
     */
    @Override
    public List<EbookCatalog> selectEbookCatalogList(EbookCatalog ebookCatalog) {
        return ebookCatalogMapper.selectEbookCatalogList(ebookCatalog);
    }

    /**
     * 新增电子书目录
     *
     * @param ebookCatalog 电子书目录
     * @return 结果
     */
    @Override
    public int insertEbookCatalog(EbookCatalog ebookCatalog) {
        return ebookCatalogMapper.insertEbookCatalog(ebookCatalog);
    }

    /**
     * 修改电子书目录
     *
     * @param ebookCatalog 电子书目录
     * @return 结果
     */
    @Override
    public int updateEbookCatalog(EbookCatalog ebookCatalog) {
        return ebookCatalogMapper.updateEbookCatalog(ebookCatalog);
    }

    /**
     * 删除电子书目录对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteEbookCatalogByIds(String ids) {
        return ebookCatalogMapper.deleteEbookCatalogByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除电子书目录信息
     *
     * @param id 电子书目录ID
     * @return 结果
     */
    @Override
    public int deleteEbookCatalogById(Long id) {
        return ebookCatalogMapper.deleteEbookCatalogById(id);
    }
}
